package com.cnpc.netty.transfer;

/**
 * @date 2018年12月10日
 * 
 * @author lhf
 * 
 * @desc 
 */
public class Main {
	private static final String UDP_ADDRESS = "192.168.0.19";
	private static final Integer UDP_PORT = 4567;
	private static final Integer LOCAL_PORT = 8001;
	private static final String TCP_ADDRESS = "127.0.0.1";
	private static final Integer TCP_PORT = 6883;

	public static void main(String[] args) {
		try {
			UdpSender udpSender = new UdpSender(UDP_ADDRESS, UDP_PORT);
			//udpSender.stop();
			Thread.sleep(1000L);
			System.out.println("UdpSender Start:" + System.currentTimeMillis());
			Transfer tran = new Transfer(udpSender, LOCAL_PORT, TCP_ADDRESS, TCP_PORT);
			tran.start();

			//for (int i = 0; i < 10; i++) {
				udpSender.queryVersion();
				Thread.sleep(1000L);
				udpSender.querySN();
				Thread.sleep(1000L);
				udpSender.queryHardware();
				Thread.sleep(1000L);
				udpSender.queryScanParam();
				Thread.sleep(1000L);
				udpSender.queryHostChannelConfig();
				Thread.sleep(1000L);
			//}

			udpSender.start();
			Thread.sleep(60000L);
			//udpSender.start1();
			//Thread.sleep(1000L);
			//udpSender.start2();
			//Thread.sleep(1000L);
			//udpSender.start3();
			//Thread.sleep(1000L);
			udpSender.stop();
		}catch (Exception e){
			e.printStackTrace();
		}
		System.out.println("UdpSender Stop:" + System.currentTimeMillis());
	}

}
